package com.bw.z.mvp.view.news.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bw.z.R;
import com.bw.z.mvp.model.entity.TextBannerEntity;
import com.youth.banner.adapter.BannerAdapter;
import com.youth.banner.util.BannerUtils;

import java.util.List;

public class TextBannerAdapter extends BannerAdapter<TextBannerEntity.Values, TextBannerAdapter.TextBannerHolder> {
    public TextBannerAdapter(List<TextBannerEntity.Values> datas) {
        super(datas);
    }

    @Override
    public TextBannerHolder onCreateHolder(ViewGroup parent, int viewType) {
        return new TextBannerHolder(BannerUtils.getView(parent, R.layout.item_news_text));
    }

    @Override
    public void onBindView(TextBannerHolder holder, TextBannerEntity.Values data, int position, int size) {
        holder.title.setText("" + data.news_title);
    }


    class TextBannerHolder extends RecyclerView.ViewHolder {
        public TextView title;

        public TextBannerHolder(@NonNull View view) {
            super(view);
            title = view.findViewById(R.id.news_text_title);
        }
    }
}
